package com.c7.util;

import java.sql.Connection;

public class DBConnection {
    private String FileName;
    private int DBType;
    private Connection conn;
    private String MySqlDriver;
    private String MySqlUrl;
    public   DBConnection(){
        conn=null;
    };
    public Connection getConn(){
        DBType=1;

        switch (DBType){
            case 1:return (getConnToMySQL());
                    default:return null;
        }
    }
    public Connection getConnToMySQL(){
        try{
            MySqlDriver="com.mysql.cj.jdbc.Driver";
            MySqlUrl="jdbc:mysql://localhost:3306/unit7website+?user=root&password=1314520&useUnicode=true&characterEncoding=utf8";
            Class.forName(MySqlDriver).newInstance();
            conn=java.sql.DriverManager.getConnection(MySqlUrl);
        }catch(Exception e){
            e.printStackTrace();
        }
        return conn;
        }
}
